-- Winter Anathema (c) v.v.balashoff
local ButtonAsyncPressedComponent = require('leviathan/ECS/Input/Components/ButtonAsyncPressedComponent')
local ButtonHoldComponent = require('leviathan/ECS/Input/Components/ButtonHoldComponent')
local Domain = require('leviathan/ECS/Domain')
local Entity = require('leviathan/ECS/Entity')
local IconComponent = require('leviathan/ECS/Input/Components/IconComponent')
local MouseClickSystem = require('leviathan/ECS/Input/Systems/MouseClickSystem')
local MouseIconSystem = require('leviathan/ECS/Input/Systems/MouseIconSystem')
local MouseWheelSystem = require('leviathan/ECS/Input/Systems/MouseWheelSystem')

local DomainInput = Domain:derive('Input')

function DomainInput:new(world)
    -- call parent constructor
    DomainInput.super.new(self, world, 'Input')
    -- entities
    local mouse = Entity(self, 'Mouse')
    -- TODO is it right?
    local mouseLeftButton = Entity(self, 'MouseLeftButton')
    local mouseRightButton = Entity(self, 'MouseRightButton')
    local mouseMiddleButton = Entity(self, 'MouseMiddleButton')
    local mouseWheel = Entity(self, 'MouseWheel')
    local keyboard = Entity(self, 'Keyboard')
    -- components
    local icon = IconComponent('mouseCursorMain')
    mouse:addComponent(icon)
    -- systems
    local iconS = MouseIconSystem(self)
    local click = MouseClickSystem(self)
    local wheel = MouseWheelSystem(self)
    -- adding systems
    DomainInput:addSystem(self, iconS)
    DomainInput:addSystem(self, click)
    DomainInput:addSystem(self, wheel)
end

return DomainInput

